export interface CodeGenConfigParams {
  genBaseConfigEntity: GenBaseConfig;
  genDataSourceEntity: GenDataSourceConfig;
  genTableConfigs: GenTableConfig[];
  pid: number;
  sort: number;
}

export interface GenBaseConfig {
  afterEndParentPath: string;
  apiPrefix?: string;
  author: string;
  moduleNameZh: string;
  frontEndParentPath?: string;
  genMode: 'zip' | 'inner';
  moduleName: string;
  otherParentPath: string;
  outputType: 'file' | 'string';
  packageName?: string;
  removeTablePrefix?: boolean;
  sqlParentPath?: string;
  tablePrefixName?: string;
  templateGroupId: number;
  version: string;
  zipName?: string;
  idType: string;
}

export interface GenDataSourceConfig {
  dbAlias: string;
  dbDriver: string;
  dbName: string;
  dbPassword: string;
  dbType: string;
  dbUrl: string;
  dbUserName: string;
  dbinfoId: number;
}

export interface GenTableConfig {
  keyFlag: boolean;
  keyName: string;
  businessName?: string;
  javaBeanName?: string;
  listConfigEntity: ListConfig;
  tableComment?: string;
  tableFieldConfig: TableFieldConfig[];
  tableName: string;
}

export interface ListConfig {
  isBatch: boolean;
  isPage: boolean;
  showAddBtn: boolean;
  existSearchField: boolean;
  showDelBtn: boolean;
  showExportBtn: boolean;
  showImportBtn: boolean;
  showUpdateBtn: boolean;
  updateOrCreateEditComponent: string;
  pid: number;
  sort: number;
}

export interface TableFieldConfig {
  keyIdentityFlag: boolean;
  keyFlag: boolean;
  comment: string;
  componentType: string;
  dictType: string;
  field: string;
  fieldDict: any[];
  isDisableField: boolean;
  isGenColumn: boolean;
  isGenFieldByUpdateOrCreate: boolean;
  isQuery: boolean;
  isShowFieldByUpdateOrCreate: boolean;
  javaType: string;
  queryModeSelect: string;
  required: boolean;
  showTableColumn: boolean;
  tsType: string;
  checkRule: string;
  propertyName: string;
  type: string;
  isCommon: boolean; //是否为BaseModel字段
}

export interface GenCodePreviewModel {
  frontEndCode: Code;
  afterEndCode: Code;
  sqlCode: Code;
  otherCode: Code;
}

export type Code = {
  [key: string]: any;
};
